<?php

namespace App\Http\Controllers\user;

use App\Dao\AddressDao;
use App\Services\Code;

class AddressController extends BaseController
{
    public function lists(){
        $params = array_merge([
            'user_id'=>getUserToken()
        ],request()->all());
        return Code::message('',200,AddressDao::lists($params));
    }

    public function set_default_address(): array
    {
        $params = array_merge([
            'user_id'=>getUserToken()
        ],request()->all());
        return Code::message('',200,AddressDao::set_default_address($params));

    }

    public function add_address()
    {
        $params = array_merge([
            'user_id'=>getUserToken()
        ],request()->all());
        return Code::message('',200,AddressDao::add_address($params));
    }

    public function update_address()
    {
        $params = array_merge([
            'user_id'=>getUserToken()
        ],request()->all());
        return Code::message('',200,AddressDao::update_address($params));
    }

    public function delete_address(): array
    {
        $params = array_merge([
            'user_id'=>getUserToken()
        ],request()->all());
        return Code::message('',200,AddressDao::delete_address($params));
    }
}
